package com.itheima.controller;

import com.itheima.entity.ProjectReview;
import com.itheima.entity.ProjectReviewProgress;
import com.itheima.pojo.jo.AccountMassagePo;
import com.itheima.pojo.po.ProjectReviewProgressPo;
import com.itheima.service.IAccountMessageService;
import com.itheima.service.IProjectReviewProgressService;
import com.itheima.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 项目审核进度Controller
 *
 * @author guanhuaer
 * @date 2025-03-18
 */
@RestController
@RequestMapping("/message")
public class AccountMessageController
{
    @Autowired
    private IAccountMessageService messageService;


    // 根据id查询消息信息
    @GetMapping("/list")
    @ApiOperation(value = "根据项目id查询数据")
    public Result findById(@RequestParam Long id) {
        return Result.success(messageService.selectAccountMessageByUserId(id));
    }

    //新增
    @PostMapping
    @ApiOperation(value = "新增项目审核过程", notes = "新增项目审核进度")
    public Result add(@RequestBody ProjectReviewProgress projectReviewProgress) {
        return Result.success();
    }

    // 根据用户id和消息类型修改信息的是否已读状态
    @PostMapping("/read")
    @ApiOperation(value = "修改消息的已读状态")
    public Result messageReadStatus(@RequestBody AccountMassagePo massagePo) {
        messageService.updateMessageReadStatus(massagePo);
        return Result.success();
    }

    // 根据用户id和消息类型查询历史消息
    @GetMapping("/history")
    @ApiOperation(value = "查询历史消息")
    public Result MassageHistory(AccountMassagePo massagePo) {
        return Result.success(messageService.selectMassageHistory(massagePo));
    }


}
